<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<link rel="stylesheet" type="text/css" href="/static/component/laytp/module/cityPicker/city-picker.css">

<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span>新建保证金返还支付</span><div class="move_title"></div><?php include "../public/sub.php";?></div></div>
    <div class="main-container">

        <div class="block-generic">


            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="edittits"><span>基本信息</span></div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>交易单号</label>
                        <div class="layui-input-block">
                            <input type="text" id="jiaonum" placeholder="请输入" disabled autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">付款编号</label>
                        <div class="layui-input-block">
                            <input type="text" id="number" placeholder="请输入" disabled autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">关联收取</label>
                        <div class="layui-input-block">
                            <input type="text" id="shouid_name" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">保证金类型</label>
                        <div class="layui-input-block">
                            <input type="text" id="bondtype" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-block">
                            <input type="text" id="enginname" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">请款金额</label>
                        <div class="layui-input-block">
                            <input type="text" id="money" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">款项摘要</label>
                        <div class="layui-input-block">
                            <input type="text" id="zhai" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">支付方式</label>
                        <div class="layui-input-block">
                            <input type="text" id="incdaotype" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">付款对象</label>
                        <div class="layui-input-block">
                            <input type="text" id="gonger" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">账户账号</label>
                        <div class="layui-input-block">
                            <input type="text" id="banknum" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">开户行</label>
                        <div class="layui-input-block">
                            <input type="text" id="bankname" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">已付金额(元)</label>
                        <div class="layui-input-block">
                            <input type="text" id="accmoney" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">未付金额(元)</label>
                        <div class="layui-input-block">
                            <input type="text" id="nomoney" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>款项类型</label>
                        <div class="layui-input-block">
                            <input type="text" readonly name="budid" class="layui-input budid" onclick="openPage('../public/choose_engin_budsub_guan_gong.php?dom=budid&page=engin_bond_fan_kuan','80%','80%')">
                            <div class="choose_div" id="budid" key="1"></div>
                            <span class="choose_one" onclick="openPage('../public/choose_engin_budsub_guan_gong.php?dom=budid&page=engin_bond_fan_kuan','80%','80%')"><i class="layui-icon layui-icon-search"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>本次付款金额(元)</label>
                        <div class="layui-input-block">
                            <input type="text" name="fumoney" id="fumoney" placeholder="请输入" autocomplete="off" class="layui-input moneyinput">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>支付账户</label>
                        <div class="layui-input-block">
                            <input type="text" readonly name="accid" class="layui-input accid" onclick="openPage('../public/choose_account.php?dom=accid','80%','80%')">
                            <div class="choose_div" id="accid" key="1"></div>
                            <span class="choose_one" onclick="openPage('../public/choose_account.php?dom=accid','80%','80%')"><i class="layui-icon layui-icon-search"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>交易日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="dt" id="dt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>经手人</label>
                        <div class="layui-input-block">
                            <input type="text" name="baner" id="baner" placeholder="请输入" clearable  autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item height_auto">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label label_textarea">备注</label>
                        <div class="layui-input-block">
                            <textarea id="explain" name="explain" placeholder="请输入" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>

            <?php include '../public/upinfo.php'?>
        </div>


    </div>
</form>
<script>
    var param_id = getQueryVariable('id') || 0;

    $("#commentForm").validate({
        rules: {
            fumoney: {required: true},
            dt: {required: true},
            baner: {required: true},
        },
        messages:{
            fumoney: {required: "请输入"},
            dt: {required: "请选择"},
            baner: {required: "请输入"},
        }
    });


    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        facade.ajax({type: 'get', url: ask_engin_bond_fan_kuan_add, data:{id:param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var shouinfo = res.data.shouinfo;
                $("#jiaonum").val(res.data.jiaonum);
                $("#dt").val(res.data.dt);
                $("#baner").val(res.data.baner);

                $("#shouid_name").val(shouinfo.number);
                $("#bondtype").val(shouinfo.bondtype);
                $("#enginname").val(shouinfo.enginname);

                $("#number").val(data.number);
                $("#budid_name").val(data.budid_name);

                $("#zhai").val(data.zhai);
                $("#money").val(data.money);
                $("#incdaotype").val(data.incdaotype);
                $("#gonger").val(data.gonger);
                $("#banknum").val(data.banknum);
                $("#bankname").val(data.bankname);
                $("#accmoney").val(data.accmoney);
                $("#nomoney").val(data.nomoney);


                public_upload_file_load('upload_files');
                initParseMoney();
                render_from();
            }
        });

        form.on('submit(add)', function(data){
            var validRes = $("#commentForm").valid();

            data.field.budid = get_choose_val('budid');
            formValid('budid');
            if(data.field.budid == undefined || !data.field.budid){
                validRes = false;
            }


            data.field.accid = get_choose_val('accid');
            formValid('accid');
            if(data.field.accid == undefined || !data.field.accid){
                validRes = false;
            }

            if(!validRes){return false;}


            data = parseMoney(data);
            data.field.id = param_id;
            data.field.files = public_upload_file_value('upload_files');
            facade.ajax({url: ask_engin_bond_fan_kuan_add, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    dataPostTimeOut();
                }
            });

            return false;
        });

    });


</script>
</body>
</html>
